package com.ruoyi.project.service.impl;

import java.util.List;

import com.ruoyi.system.mapper.ProjectContractDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mapper.ProjectContractMapper;
import com.ruoyi.project.domain.ProjectContract;
import com.ruoyi.project.service.IProjectContractService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 项目合同Service业务层处理
 * 
 * @author zhaogang
 * @date 2024-07-18
 */
@Service
public class ProjectContractServiceImpl implements IProjectContractService 
{
    @Autowired
    private ProjectContractMapper projectContractMapper;
    @Autowired
    private ProjectContractDetailMapper projectContractDetailMapper;

    /**
     * 查询项目合同
     * 
     * @param contractId 项目合同主键
     * @return 项目合同
     */
    @Override
    public ProjectContract selectProjectContractByContractId(Long contractId)
    {
        return projectContractMapper.selectProjectContractByContractId(contractId);
    }

    /**
     * 查询项目合同列表
     * 
     * @param projectContract 项目合同
     * @return 项目合同
     */
    @Override
    public List<ProjectContract> selectProjectContractList(ProjectContract projectContract)
    {
        return projectContractMapper.selectProjectContractList(projectContract);
    }

    /**
     * 新增项目合同
     * 
     * @param projectContract 项目合同
     * @return 结果
     */
    @Override
    public int insertProjectContract(ProjectContract projectContract)
    {
        return projectContractMapper.insertProjectContract(projectContract);
    }

    /**
     * 修改项目合同
     * 
     * @param projectContract 项目合同
     * @return 结果
     */
    @Override
    public int updateProjectContract(ProjectContract projectContract)
    {
        return projectContractMapper.updateProjectContract(projectContract);
    }

    /**
     * 批量删除项目合同
     * 
     * @param contractIds 需要删除的项目合同主键
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteProjectContractByContractIds(Long[] contractIds) {
        projectContractDetailMapper.deleteProjectContractDetailByContractIds(contractIds);
        return projectContractMapper.deleteProjectContractByContractIds(contractIds);
    }

    /**
     * 删除项目合同信息
     * 
     * @param contractId 项目合同主键
     * @return 结果
     */
    @Override
    public int deleteProjectContractByContractId(Long contractId)
    {
        return projectContractMapper.deleteProjectContractByContractId(contractId);
    }

    @Override
    public int deleteByContractIds(Long[] contractIds) {
        return 0;
    }
}
